Use Graphene init macros for compound literals
authorEmmanuele Bassi <ebassi@gnome.org>
Mon, 21 Nov 2016 16:21:38 +0000 (16:21 +0000)
committerEmmanuele Bassi <ebassi@gnome.org>
Mon, 21 Nov 2016 16:21:38 +0000 (16:21 +0000)
The Graphene init macros can now be used for compound literals, which
means we need to update our mixed uses.

13 files changed:
gtk/gtkcssimage.c
gtk/gtkcssimagebuiltin.c
gtk/gtkcssshadowvalue.c
gtk/gtkcsstransformvalue.c
gtk/gtkdebugupdates.c
gtk/gtkdrawingarea.c
gtk/gtkentry.c
gtk/gtkflowbox.c
gtk/gtklabel.c
gtk/gtkrenderbackground.c
gtk/gtkrenderborder.c
gtk/gtkrendericon.c
gtk/inspector/rendernodeview.c

index 81ab757a140d775c6572c18531c0fdfcc2168cd9..8797ec900bb96ee4328312f0678dac43e06199de 100644 (file)
@@ -104,7 +104,7 @@ gtk_css_image_real_snapshot (GtkCssImage *image,
   cairo_t *cr;
 
   cr = gtk_snapshot_append_cairo_node (snapshot,
-                                       &(graphene_rect_t)GRAPHENE_RECT_INIT (0, 0, width, height),
+                                       &GRAPHENE_RECT_INIT (0, 0, width, height),
                                        "Fallback<%s>", G_OBJECT_TYPE_NAME (image));
   _gtk_css_image_draw (image, cr, width, height);
   cairo_destroy (cr);
index 841ae91d26e1459a7c15e8e10748b9149374ed5e..00a267ca1a6621d76e23607745b6939a767641bf 100644 (file)
@@ -664,7 +664,7 @@ gtk_css_image_builtin_snapshot (GtkCssImage            *image,
     }
 
   cr = gtk_snapshot_append_cairo_node (snapshot,
-                                       &(graphene_rect_t)GRAPHENE_RECT_INIT (0, 0, width, height),
+                                       &GRAPHENE_RECT_INIT (0, 0, width, height),
                                        "BuiltinImage<%d>", (int) image_type);
   gtk_css_image_builtin_draw (image, cr, width, height, image_type);
   cairo_destroy (cr);
index 3c7aeb93aee4c148b287f2fbd8c9821abc72e877..a86dd9ab2d40d98135e1d28a48ed063c0553b990 100644 (file)
@@ -1038,7 +1038,7 @@ gtk_css_shadow_value_snapshot_outset (const GtkCssValue   *shadow,
   gtk_css_shadow_value_get_extents (shadow, &extents);
 
   cr = gtk_snapshot_append_cairo_node (snapshot,
-                                       &(graphene_rect_t) GRAPHENE_RECT_INIT (
+                                       &GRAPHENE_RECT_INIT (
                                           border_box->box.x - extents.left,
                                           border_box->box.y - extents.top,
                                           border_box->box.width + extents.left + extents.right,
@@ -1062,7 +1062,7 @@ gtk_css_shadow_value_snapshot_inset (const GtkCssValue   *shadow,
     return;
 
   cr = gtk_snapshot_append_cairo_node (snapshot,
-                                       &(graphene_rect_t) GRAPHENE_RECT_INIT (
+                                       &GRAPHENE_RECT_INIT (
                                           padding_box->box.x,
                                           padding_box->box.y,
                                           padding_box->box.width,
index 4439ba16ead26b7280989527fb0e558dad68cb9b..9c70dbb25e80d7b4af9b5efcc30ebee635ba3768 100644 (file)
@@ -174,7 +174,7 @@ gtk_css_transform_apply (const GtkCssTransform   *transform,
       graphene_matrix_init_from_matrix (matrix, &tmp);
       break;
     case GTK_CSS_TRANSFORM_TRANSLATE:
-      graphene_matrix_translate (matrix, &(graphene_point3d_t)GRAPHENE_POINT3D_INIT(
+      graphene_matrix_translate (matrix, &GRAPHENE_POINT3D_INIT(
                                  _gtk_css_number_value_get (transform->translate.x, 100),
                                  _gtk_css_number_value_get (transform->translate.y, 100),
                                  _gtk_css_number_value_get (transform->translate.z, 100)));
index b1d0cf3b5214ee544b97efd9c146b46e79b1665b..3219314f5836ae1eff535002b474b5d3234c2c71 100644 (file)
@@ -290,7 +290,7 @@ gtk_debug_updates_snapshot (GtkWidget   *widget,
 
   gtk_debug_updates_queue_get_extents (updates, &rect);
   cr = gtk_snapshot_append_cairo_node (snapshot,
-                                       &(graphene_rect_t) GRAPHENE_RECT_INIT(rect.x, rect.y, rect.width, rect.height),
+                                       &GRAPHENE_RECT_INIT(rect.x, rect.y, rect.width, rect.height),
                                        "Debug Updates");
 
   for (l = g_queue_peek_head_link (updates); l != NULL; l = l->next)
index 7d4f2ef87dd29173446820ea9686611924e1f486..ecea4c6e9aa8fb24ab9580e983c6c442557e637c 100644 (file)
@@ -240,7 +240,7 @@ gtk_drawing_area_snapshot (GtkWidget   *widget,
     return;
 
   cr = gtk_snapshot_append_cairo_node (snapshot,
-                                       &(graphene_rect_t) GRAPHENE_RECT_INIT(0, 0,
+                                       &GRAPHENE_RECT_INIT (0, 0,
                                          gtk_widget_get_allocated_width (widget),
                                          gtk_widget_get_allocated_height (widget)),
                                        "DrawingAreaContents");
index 2a55109542675a6fd37cefe60262e2bc84deccf9..241d1d7b15e08a5e20b1a9132268bf98cbe237ef 100644 (file)
@@ -3600,10 +3600,10 @@ gtk_entry_render (GtkCssGadget *gadget,
 
   /* Draw text and cursor */
   cr = gtk_snapshot_append_cairo_node (snapshot,
-                                       &(graphene_rect_t) GRAPHENE_RECT_INIT (x + priv->text_x,
-                                                                              y,
-                                                                              priv->text_width,
-                                                                              height),
+                                       &GRAPHENE_RECT_INIT (x + priv->text_x,
+                                                            y,
+                                                            priv->text_width,
+                                                            height),
                                        "Entry Text");
 
   if (priv->dnd_position != -1)
index 1a7c2576744dbc2d36741877689645cc955a67a7..d543d5445c6b943999652621a6fd845e6a4e0393 100644 (file)
@@ -2592,7 +2592,7 @@ gtk_flow_box_render (GtkCssGadget *gadget,
       vertical = priv->orientation == GTK_ORIENTATION_VERTICAL;
 
       cr = gtk_snapshot_append_cairo_node (snapshot,
-                                           &(graphene_rect_t)GRAPHENE_RECT_INIT(x, y, width, height),
+                                           &GRAPHENE_RECT_INIT (x, y, width, height),
                                            "FlowBox Rubberband");
 
       context = gtk_widget_get_style_context (widget);
index e9e6a69bf6d92fe29d6ed4873ebcb5a9ac2b3728..42dac23e2647263c15a9ea97eeee5ec68eb105fd 100644 (file)
@@ -4169,7 +4169,7 @@ gtk_label_snapshot (GtkWidget   *widget,
 static void layout_to_window_coords (GtkLabel *label,
                                      gint     *x,
                                      gint     *y);
-#define GRAPHENE_RECT_FROM_RECT(_r) ((graphene_rect_t) GRAPHENE_RECT_INIT ((_r)->x, (_r)->y, (_r)->width, (_r)->height))
+#define GRAPHENE_RECT_FROM_RECT(_r) (GRAPHENE_RECT_INIT ((_r)->x, (_r)->y, (_r)->width, (_r)->height))
 
 static gboolean
 gtk_label_render (GtkCssGadget *gadget,
@@ -4231,7 +4231,7 @@ gtk_label_render (GtkCssGadget *gadget,
           range_clip = gdk_pango_layout_get_clip_region (priv->layout, lx, ly, range, 1);
           cairo_region_get_extents (range_clip, &clip_extents);
           cr = gtk_snapshot_append_cairo_node (snapshot,
-                                               &GRAPHENE_RECT_FROM_RECT(&clip_extents),
+                                               &GRAPHENE_RECT_FROM_RECT (&clip_extents),
                                                "Selected Text");
           gtk_style_context_save_to_node (context, info->selection_node);
 
index 11c70b81b2182b038106b2e20f88bdd9ef1433b4..9388dd81a0869f96703f69c284989199a9df39c4 100644 (file)
@@ -465,7 +465,7 @@ gtk_css_style_snapshot_background (GtkCssStyle      *style,
    * background. GSK can't do that yet.
    */
   cr = gtk_snapshot_append_cairo_node (snapshot,
-                                       &(graphene_rect_t)GRAPHENE_RECT_INIT(0, 0, width, height),
+                                       &GRAPHENE_RECT_INIT (0, 0, width, height),
                                        "Background");
 
   _gtk_theming_background_paint_color (&bg, cr, bg_color, background_image);
index 2672dec035a29567845a6eb9b203874cac75abed..62b0367c46c9e3795130beb515166def35ea8456 100644 (file)
@@ -948,7 +948,7 @@ gtk_css_style_snapshot_outline (GtkCssStyle *style,
       _gtk_rounded_box_apply_outline_radius_for_style (&border_box, style, GTK_JUNCTION_NONE);
 
       cr = gtk_snapshot_append_cairo_node (state,
-                                           &(graphene_rect_t) GRAPHENE_RECT_INIT (rect.x, rect.y, rect.width, rect.height),
+                                           &GRAPHENE_RECT_INIT (rect.x, rect.y, rect.width, rect.height),
                                            "Outline");
 
       render_border (cr, &border_box, border_width, 0, colors, border_style);
index 9578ea4f30a1cfef3e319f77d6bb3951799d1a39..7355ebed2645117fffc4fadfc868810d1d98fe09 100644 (file)
@@ -116,9 +116,9 @@ gtk_css_style_snapshot_icon (GtkCssStyle            *style,
   graphene_matrix_init_from_matrix (&saved_matrix, gtk_snapshot_get_transform (snapshot));
 
   /* XXX: Implement -gtk-icon-transform-origin instead of hardcoding "50% 50%" here */
-  graphene_matrix_init_translate (&m1, &(graphene_point3d_t)GRAPHENE_POINT3D_INIT(width / 2.0, height / 2.0, 0));
+  graphene_matrix_init_translate (&m1, &GRAPHENE_POINT3D_INIT(width / 2.0, height / 2.0, 0));
   graphene_matrix_multiply (&transform_matrix, &m1, &m3);
-  graphene_matrix_init_translate (&m2, &(graphene_point3d_t)GRAPHENE_POINT3D_INIT(- width / 2.0, - height / 2.0, 0));
+  graphene_matrix_init_translate (&m2, &GRAPHENE_POINT3D_INIT(- width / 2.0, - height / 2.0, 0));
   graphene_matrix_multiply (&m2, &m3, &m1);
   gtk_snapshot_transform (snapshot, &m1);
 
@@ -230,7 +230,7 @@ gtk_css_style_render_icon_get_extents (GtkCssStyle  *style,
   if (!gtk_css_transform_value_get_matrix (gtk_css_style_get_value (style, GTK_CSS_PROPERTY_ICON_TRANSFORM), &transform_matrix))
     return;
 
-  graphene_matrix_init_translate (&translate_matrix, &(graphene_point3d_t)GRAPHENE_POINT3D_INIT(x + width / 2.0, y + height / 2.0, 0));
+  graphene_matrix_init_translate (&translate_matrix, &GRAPHENE_POINT3D_INIT(x + width / 2.0, y + height / 2.0, 0));
   graphene_matrix_multiply (&transform_matrix, &translate_matrix, &matrix);
   graphene_rect_init (&bounds,
                       - width / 2.0, - height / 2.0,
@@ -273,9 +273,9 @@ gtk_css_style_snapshot_icon_texture (GtkCssStyle *style,
   graphene_matrix_init_from_matrix (&saved_matrix, gtk_snapshot_get_transform (snapshot));
 
   /* XXX: Implement -gtk-icon-transform-origin instead of hardcoding "50% 50%" here */
-  graphene_matrix_init_translate (&m1, &(graphene_point3d_t)GRAPHENE_POINT3D_INIT(width / 2.0, height / 2.0, 0));
+  graphene_matrix_init_translate (&m1, &GRAPHENE_POINT3D_INIT(width / 2.0, height / 2.0, 0));
   graphene_matrix_multiply (&transform_matrix, &m1, &m3);
-  graphene_matrix_init_translate (&m2, &(graphene_point3d_t)GRAPHENE_POINT3D_INIT(- width / 2.0, - height / 2.0, 0));
+  graphene_matrix_init_translate (&m2, &GRAPHENE_POINT3D_INIT(- width / 2.0, - height / 2.0, 0));
   graphene_matrix_multiply (&m2, &m3, &m1);
   gtk_snapshot_transform (snapshot, &m1);
 
index 7757fb511c04b3ff66bc92553cf1d68395fa326a..c9202043bd1c080646f84573ade611de3838fd11 100644 (file)
@@ -239,9 +239,8 @@ gtk_render_node_view_snapshot (GtkWidget   *widget,
   cairo_translate (cr, - viewport.x - viewport.width / 2.0, - viewport.y - viewport.height / 2.0);
 
   fallback = gsk_renderer_create_fallback (gtk_snapshot_get_renderer (snapshot),
-                                           &(graphene_rect_t)
-                                               GRAPHENE_RECT_INIT (viewport.x, viewport.y,
-                                                                   viewport.width, viewport.height),
+                                           &GRAPHENE_RECT_INIT (viewport.x, viewport.y,
+                                                                viewport.width, viewport.height),
                                            cr);
   gsk_renderer_render (fallback, priv->render_node, NULL);
   g_object_unref (fallback);